<?php
/**
 * Created by PhpStorm.
 * User: sen
 * Date: 16/7/13
 * Time: 下午4:18
 */
namespace app\controllers;
use yii\web\Controller;
use yii\web\Cookie;
use yii;
use app\models\User;

class BackbaseController extends Controller{

    public function init(){
        $this->enableCsrfValidation = false;
        if(!\Yii::$app->user->id){
            $url = \Yii::$app->request->getPathInfo();
            return $this->redirect('../login/index?url='.$url);
        }
        $userId = \Yii::$app->user->id;
        $user = new User();
        $admin = $user->findIdentity($userId);
        if($admin['type']==2 or $admin['type']==0){
            return $this->redirect('../login/logout');
        }
    }


}